import multiprocessing

'''
    跨文件，全局变量管理队列
'''


def __init__(size):
    global _queue
    _queue = multiprocessing.Queue(size)
    print('队列已初始化')


def put(json, block=True, timeout=None):
    """如队列已满，则程序进入阻塞状态，等待队列取出后再放入"""
    _queue.put(json, block, timeout)


def get(block=True, timeout=None, defValue=None):
    try:
        return _queue.get(block, timeout)
    except KeyError:
        return defValue
